package com.yitiao.multithread.threadpool;

import java.util.concurrent.*;

public class SimpleThreadPoolExecutors extends ThreadPoolExecutor {

    public SimpleThreadPoolExecutors(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
    }

    public SimpleThreadPoolExecutors(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
    }

    public SimpleThreadPoolExecutors(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
    }

    public SimpleThreadPoolExecutors(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
    }

    @Override
    protected void finalize() {
        super.finalize();
    }

    @Override
    protected void beforeExecute(Thread t, Runnable r) {
        System.out.println(t.getName());
        System.out.println(t.getContextClassLoader().getClass());
        System.out.println(super.getTaskCount());
    }

    @Override
    protected void afterExecute(Runnable r, Throwable t) {
        super.afterExecute(r, t);
        System.out.println(super.getTaskCount());
    }

    @Override
    protected void terminated() {
        System.out.println(super.getTaskCount());
    }
}
